home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 21
/
Cream of the Crop 21 (Terry Blount) (October 1996).iso
/
doom
/
hxtutor.zip
/
HXTUTOR.DOC
< prev
next >
Wrap
Text File
|
1996-07-09
|
15KB
|
388 lines
Hexen Script Tutorial
version .7
Authors: Chris White(cwhite@colorado.net)
This file should contain the following files:
HXTUTOR.WAD - The 4 level Pwad file
HXTUTOR.DOC - The Manual, this file
HXTUTO01.ACS - The fully commented Script File for Level 1
HXTUTO02.ACS - The fully commented Script File for Level 2
HXTUTO03.ACS - The fully commented Script File for Level 3
APP_A.TXT - The Appendix with lists of TID's, SECTOR TAG's and LINE ID's
HXTUTOR.TXT - The text description file in Wad Template format
All of these(except the Wad file and HXTUTOR.TXT) should be printed out, so
that you can follow along as the level progresses.
You should also have a copy of the HEXEN SPECS by Ben Morris, version 0.9 is
the latest as of this writing.
Although this file was originally intended to be a Script Tutorial(and it
still is), I have included other tricks that I thought might need some
explaining. Why did I create this? There are Not enough Good Hexen levels
out there, I believe it is the Scripts that are scarring people away from
Hexen editing. Also, I think learning to edit and program Hexen will prepare
myself and others for editing the game we are all waiting for, QUAKE!! In
fact, QUAKE will have it's own C language. All of you Doom editors that
refuse to play with Hexen for one reason or another will be behind the people
who have mastered and learned to program Hexen, when Quake does arrive.
Scripting Basics
The basic sript structure consists of two types OPEN and CALLED
OPEN scripts do not take arguments, they are Mainly used for things such as
Ambient Sounds(crickets, birds, katydids, gongs etc.) and for the Random
Spawning of Ettins and other monsters. They are also used to check if
Puzzles have been completed yet.
A Sample OPEN Script: (Taken from HEXEN MAP01)
script 253 OPEN
{
delay(random(3, 7)*100);
thingsound(36, "Ambient6", 100);
restart;
}
This script is OPEN, so it automatically starts when the Level starts.
Lets examine it line by line:
delay(random(3, 7)*100); This is the same as delay 300 or 400 or 500 or 600
or 700. Or dividing by 35 tics per second equals
a delay of Roughly 9, 12, 15, 18 or 20 seconds.
thingsound(36, "Ambient6", 100); This plays the sound Ambient6 at all things
with TID of 36(Most likely just X_MapSpots)
and with a volume of 100(on a scale of 1-127)
Ambient6 is simply an Owl
restart; Restart the Script
What does this Script do?
- It waits for 8 to 20 seconds
- Plays an owl sound(who who)
- restarts
- It waits for 8 to 20 seconds
- Plays an owl sound(who who)
- restarts
- It waits for 8 to 20 seconds
- Plays an owl sound(who who)
- restarts
- It waits for 8 to 20 seconds
- Plays an owl sound(who who)
- restarts
- Etc.,Etc.,Etc.,Etc.,Etc.....
Lets examine another OPEN Script (Also taken from HEXEN MAP01)
script 255 OPEN
{
int var0;
delay(8400);
var0 = random(0, 1);
if(var0 ==1)
{
Thing_Spawn(255, T_ETTIN, 128);
}
var0 = random(0, 1);
if(var0 ==1)
{
Thing_Spawn(254, T_ETTIN, 196);
}
var0 = random(0, 1);
if(var0 ==1)
{
Thing_Spawn(253, T_ETTIN, 196);
}
var0 = random(0, 1);
if(var0 ==1)
{
Thing_Spawn(252, T_ETTIN, 0);
}
restart;
}
Again, lets examine it Line by Line
int var0; This just Declares a Variable var0. This could be called WaitTime,
EttinWait, WaItaLiTtle, variableZero, v, v0 or Whatever YOU want
to call it!!
delay(8400); Wait 8400/35 = 240 Seconds or 4 minutes
var0 = random(0, 1); var0 equals either 0 or 1
if(var0 == 1) if var0 equals 1, as opposed to 0(50% chance)
{
Thing_Spawn(255, T_ETTIN, 128); Spawns an Ettin at thing with TID 255
} (again just a X_MapSpot)
Angle = 128 or West
The next 3 IF statements are the same as the above, they just have different
TID's and Angles
restart; Restart the Script
What does this do?
-It waits for 4 minutes
-Picks a Random Number(0 or 1 50% chance)
-If Random Number = 1(50%) Spawns an Ettin at TID 255's at angle 128(West)
-Picks a Random Number(0 or 1 50% chance)
-If Random Number = 1(50%) Spawns an Ettin at TID 254's at angle 196(~South)
-Picks a Random Number(0 or 1 50% chance)
-If Random Number = 1(50%) Spawns an Ettin at TID 253's at angle 196(~South)
-Picks a Random Number(0 or 1 50% chance)
-If Random Number = 1(50%) Spawns an Ettin at TID 252's at angle 0(East)
-Restarts
-Etc.,Etc.,Etc.,Etc.,Etc....
CALLED Scripts May or May Not take Arguments. Remember, OPEN Scripts Start
Automatically when the Level starts. CALLED Scripts are called from the
statement ACS_EXECUTE. This can be when a Line is Crossed, Hit, Hit By
Weapon, Crossed By Monster, Used, etc.. Or can be activated when a Thing is
Destroyed. Or called from within another Script.
A Sample Called Script with No Arguments
script 1 (void)
{
print(s:"YOU'RE GETTING CLOSER);
}
What does this do?
It simply prints: you're getting closer
when the script is called
How is it called?
This script would most likely be called by crossing a linedef.
For example:
Say you are looking for a key to open a door, pick a line that is close to
the key. When the player crosses the line, he sees this message and knows
that he is getting close to finding the key.
You would give the line special ACS_Execute
The lines arguments would be:
1 1 0 0 0
| | | | |
| | Not used as this script is (void) and takes No Arguments
| |
| Map, assuming this script is for MAP01
|
Script number 1
A Sample Called Script with Arguments (The Breaking Glass Windows
From HEXEN MAP01)
script 1 (int arg0, int ar1, int arg2)
Now lets stop for a second, this is how the decompiled script looks when
decomplied using DEACC or similar utility. What did this script look like
before Raven compiled it? Remember that the Variable Names cannot be
retrieved when decompiling a Script, so they are just given names such as
arg0, arg1, arg2 etc. The original probably looked more like this:
script 1 ( SectorNum, SoundTID, GlassTID)
{
int GlassCount;
Floor_LowerInstant( SectorNum, 0, 16);
thingsound( SoundTID, "GlassShatter", 127);
delay(1);
GlassCount = 20;
while(GlassCount >0)
{
GlassCount--;
Thing_ProjectileGravity(SoundTID, random(54, 63), random(0, 255),
random(10, 40), random(5, 20));
Thing_ProjectileGravity(GlassTID, random(54, 63), random(0, 255),
random(10, 40), random(5, 20));
}
}
Again lets examine it line by line
int GlassCount; This just declares a variable to be used in the While
loop.
Floor_LowerInstant( SectorNum, 0, 16); This lowers the sector whose Tag =
SectorNum. This function takes No
2nd argument, so it is 0. 16 is the
Height that it lowers in 8 pixel
units. 16*8 = 128 and we all know
how high that is.
thingsound( SoundTID, "GlassShatter", 127); This plays the sound GlassShatter
at all things(X_MapSpots) with
a TID = Sound TID
delay(1); Waits for 1/35 of a second
GlassCount = 20; Sets the Local Variable GlassCount to 20
while( GlassCount > 0); GlassCount = 20 right now
{
GlassCount--; Subtracts 1 from GlassCount
Thing_ProjectileGravity(SoundTID, random(54, 63), random(0, 25